package com.iplay.dahua.chapter1;


/**
 * 计算器简单工厂模式
 * @author dangwu
 * @since 2021/3/9 5:28 下午
 */
public class OperationFactory {
    public static Operation createOperation(String oprate){
        Operation operation = null;
        switch (oprate){
            case "+": operation = new OperationAdd(); break;
            case "-": operation = new OperationSub(); break;
            case "*": operation = new OperationMul(); break;
            case "/": operation = new OperationDiv(); break;
            default:;break;
        }
        return operation;
    }
}
